<template>
  <div class="hello_world">
    <div>{{ msg }}</div>
    <child></child>
    <button @click="change">点击改变子组件值</button>
  </div>
</template>

<script>
import child from "./child.vue";
export default {
  components: { child },
  data() {
    return {
      msg: "Welcome",
    };
  },
  methods: {
    change() {
      // 获取到子组件
      console.log(this.$children);

      this.$children[0].message == "JavaScript"
        ? (this.$children[0].message = "Vue")
        : (this.$children[0].message = "JavaScript");
    },
  },
};
</script>
